﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace lcreport.Web
{
    public partial class smjb : System.Web.UI.Page
    {
        lcreport.BLL.reportinfo bll = new lcreport.BLL.reportinfo();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Session["user"] == null)
                {
                    Maticsoft.Common.MessageBox.ShowAndRedirect(this, "请先登录！", "login.aspx");

                }
                else
                {
                    BindData();
                }
            }

        }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            BindData();
        }
        public void BindData()
        {
            if (Session["user"] != null)
            {
                Model.userinfo u = Session["user"] as Model.userinfo;
                int uid = u.uid;
                DataSet ds = new DataSet();
                StringBuilder strWhere = new StringBuilder();
                if (txtKeyword.Text.Trim() != "")
                {

                    strWhere.AppendFormat(" and rtitle like '%{0}%'", txtKeyword.Text.Trim());
                }
                strWhere.AppendFormat("and uid='{0}'", uid);
                ds = bll.GetList(strWhere.ToString());
                gridView.DataSource = ds;
                gridView.DataBind();
            }
            else
            {
                Maticsoft.Common.MessageBox.ShowAndRedirect(this, "请先登录！", "login.aspx");
            }
        }        
    }
}